import json

from base_service import BaseService

# 定义UserService类，提供该服务下对应的1种方法
class UserService(BaseService):
    def __init__(self):
        super().__init__()
        self.service_name = "UserService"

    # 根据用户名查询用户信息
    def find_by_username(self, username):
        resp = self.dubbo_client.invoke(self.service_name, "findByUsername", username)
        if resp == "null":
            return None
        else:
            return json.loads(resp)
